home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga CD-Sensation: Golden Games
/
Amiga CD-Sensation - Ausgabe 2 - Golden Games (1996)(GTI - Schatztruhe)(DE)[!].iso
/
Adventurer's
/
ImpPro
/
Scripts
/
RandomMaze.dungeon
< prev
next >
Wrap
Text File
|
1995-05-02
|
2KB
|
74 lines
/* Random maze generating script for Imp Professional via the Dungeon Module
(C) Zach Forsyth 1995
$VER: 0.5
*/
options results
address IMPDUNGEON.1
call random(,,time('s')) /* Seed the random # generator */
GET MAPX
max_x = RESULT /* Get the maximum X value */
GET MAPY
max_y = RESULT /* Get the maximum Y value */
GET BRUSH
orig_brush = RESULT /* Store user's original brush */
twisty = 3 /* Higher twisty values make the maze less twisty :) */
iter = 1000 /* Number of iterations */
x = random(0, max_x) /* Random X and Y */
y = random(0, max_y)
d = random(0, 3) /* Random direction */
SETBRUSH 1
do i = 0 to iter
PAINT x y
ok = RESULT
if (i // 25) = 0 then do
s = "Iteration " || i || " of " || iter
MESSAGE s
end
r = random(0, twisty)
if r = 0 then do
r = random(0, 1)
if r = 0 then do
d = d - 1
if d < 0 then d = 3
end
else do
d = d + 1
if d > 3 then d = 0
end
end
select
when d = 0 then y = y - 1
when d = 1 then x = x + 1
when d = 2 then y = y + 1
when d = 3 then x = x - 1
otherwise nop
end
if x < 0 then do /* Hit the west border, turn around */
x = 0
d = 1
end
if x > max_x then do /* Hit the east border, turn around */
x = max_x
d = 3
end
if y < 0 then do /* Hit the north border, turn around */
y = 0
d = 2
end
if y > max_y then do /* Hit the south border, turn around */
y = max_y
d = 0
end
end
MESSAGE /* Proper script behavior, return things to */
SETBRUSH orig_brush /* the way they were before the script ran */